package za.org.jcicada.syshealth;

import java.io.Serializable;

import org.jfree.chart.axis.NumberTickUnit;

import za.org.jcicada.genss.sensor.impl.TypeDiscrete;

public class DiscreteTickUnit extends NumberTickUnit implements Serializable {

	private static final long serialVersionUID = 1L;
	
	private String[] strings;

	public DiscreteTickUnit(TypeDiscrete type) {
		super(1.0);
		strings = type.toStringArray();
	}
	
	@Override
	public String valueToString(double value) {
		int integer = (int) value;
		return integer < strings.length ? strings[integer] : "";
	}
}
